package com.zhuangjie.mvc.config;

import com.zhaungjie.base.utils.json.ObjectMapperBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

/**
 * jackson配置
 * 可以解决new Object()序列化问题与指定日期格式序列化
 * @author zhuangjie
 * @date 2023/10/08
 */
@Configuration
public class JacksonConfig {

    @Bean
    public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
        converter.setObjectMapper(ObjectMapperBuilder.ReadyMade.FOR_JS_OM);
        return converter;
    }
}